import { Node, Vec3 } from "cc";
import { ecs } from "db://app-game/libs/ecs/ECS";
import FlowGrid from "db://app-game/libs/math/pathfinding/flow-field/FlowGrid";
import { MapBaseInfo } from "./MapModelComp";

/** 地图渲染模型组件 */
@ecs.register("MapRenderModel")
export class MapRenderModelComp extends ecs.Comp {
  /** 中心节点 */
  target: Node | Vec3 | null = null;
  /** 当前地图索引 */
  currentMapIndex: { row: number; col: number } = { row: -1, col: -1 };
  /** 当前渲染地图 */
  currentRenderMap: Map<string, MapBaseInfo> = new Map();
  /** 流动网格 */
  flowGrid: FlowGrid = null;

  reset(entity: ecs.Entity): void {
    this.target = null;
    this.currentMapIndex = { row: -1, col: -1 };
    this.currentRenderMap = new Map();
    this.flowGrid = null;
  }
}
